docs: add Claude Code on-disk format reference#55
Merged
Conversation
Twelve focused docs under docs/agents/formats/claude-code/ covering the JSONL envelope, entry types, the message object, tool-call lifecycle, token accounting, session chains and compaction, peripheral files, rules for writing Claude-compatible JSONL, known issues, a linear end-to-end walkthrough, and a version-keyed format changelog. Reference revision 2026-04-23; tracks Claude Code 2.1.x (first-hand samples 2.1.37 through 2.1.112). Wire for discoverability: - Root README and CLAUDE.md point into the reference. - toolpath-claude README calls it the authoritative spec. - writing-compatible-jsonl.md and cmd_incept.rs cross-reference each other; cmd_incept.rs is documented as the reference writer.
|
🔍 Preview deployed: https://eab770c8.toolpath.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
docs/agents/formats/claude-code/— a practitioner-grade reference for Claude Code's on-disk JSONL session format. Twelve focused docs cover the envelope, entry types, themessageobject, tool-call lifecycle, token accounting, session chains and compaction, peripheral files, the empirical rules for writing Claude-compatible JSONL, known issues, a linear walkthrough, and a version-keyed format changelog.README.mdandCLAUDE.mdlink into it.crates/toolpath-claude/README.mdcalls it the authoritative spec.writing-compatible-jsonl.mdandcrates/toolpath-cli/src/cmd_incept.rscross-reference each other;cmd_incept.rsis documented as the reference writer for the "write-compatible JSONL" rules.docs/agents/formats/README.md(the format-directory index) to also point at the existing siblingcodex.md,gemini.md,opencode.mdsingle-file references that landed onmainalongside this work.fmtcommit touching four unrelated files (toolpath-claude/src/derive.rs,toolpath-cli/src/bin/gen_synthetic_path.rs,toolpath-convo/src/derive.rs,toolpath-desktop/src/tray.rs) — purecargo fmt --alloutput, no logic changes. Kept as a separate commit for auditability.What's not in this PR (by design)
site/isn't wired up to publish them.Both gaps are called out in commit history and in
format-changelog.md's maintenance process.Test plan
cargo check -p toolpath-clipasses (cmd_incept.rsgained a module-level doc comment pointing atwriting-compatible-jsonl.md)..mdunderdocs/agents/formats/claude-code/.jsonl-envelope.mdmatchesConversationEntryincrates/toolpath-claude/src/types.rsfield-for-field.docs/agents/formats/claude-code/README.mdagrees with the date informat-changelog.md.walkthrough.md— each entry-type class appears at least once (permission-mode, direct user, assistant with tool_use, tool_result carrier, text-only assistant, turn_duration, compact_boundary, synthetic summary, follow-up, rotation and sidechain previews).